'use strict';

module.exports = app => {
  const { router, controller: { advantage }, middleware: { validator, checkPageTable, checkParams } } = app;

  const baseUrl = '/api/advantage';
  router.get(baseUrl + '/all', advantage.all);
  router.get(baseUrl, checkPageTable(), advantage.index);
  router.get(baseUrl + '/:id', checkParams(), advantage.show);
  router.post(baseUrl, validator('advantage.create'), advantage.create);
  router.put(baseUrl + '/:id', checkParams(), validator('advantage.update'), advantage.update);
  router.delete(baseUrl + '/:id', checkParams(), advantage.destroy);
};
